//对商品详情页数据提纯
let fs = require('fs')
fs.readFile('./goods.json','utf-8',function (err,data) {
      let newDate = JSON.parse(data)//把json字符串转化为js对象
      let pushDate = []
      newDate.RECORDS.map((value,index) =>{
          if(value.IMAGE1!=null){
               pushDate.push(value)
          }
      })

      //js对象转成json字符串
      fs.writeFile('./newGoods.json',JSON.stringify(pushDate),(err,data)=>{
             if(err) console.log('文件写入失败')
             else console.log('文件写入成功')
      })
})
